﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
  <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
  <link rel="stylesheet" href="../css/uftestsuite.css" type="text/css" />
  <script type="text/javascript" src="iso-date.js"></script>
  <title>Microformats date and time formats</title>
  <script type="text/javascript">
  	function checkDates( id) {
  		elt = document.getElementById(id);
  		iso = new ISODate( elt.value );
  		//iso.Parse( elt.value );
  		//iso.format ='standard';
  		alert( iso.toString() );
  	}
  	
  	function compareDates( id1, id2 ) {
  		elt1 = document.getElementById(id1);
  		elt2 = document.getElementById(id2);
  		output = new ISODate( elt1.value ).toString() + ' - ' + new ISODate( elt2.value ).toString();
  		alert( 'Are equal: ' + CompareISODates( elt1.value, elt2.value ) + '\n' + output );
  	}

  
  </script>
</head>
<body class="documentation">

    <p>
    <a href="http://www.ufxtract.com/testsuite/"><img border="0" id="testsuite-image" alt="Microformats testsuite" src="../images/testsuite.gif" /></a><br />
    </p>
    
    <h1>Microformats date and time formats</h1>
    
    <h2>Introduction</h2>
    <p>
    Microformats use two subsets of ISO 8601 standard to describe dates and times. ISO 8601 is an 
	expansive standard which contains a large number of different ways to 
	represent dates and time. 
    To reduce the possibility of errors and the complexity for authors, the community has 
	chosen to restrict the supported formats used in microformats. These 
    restricted subsets are called profiles. The two profiles that can be used for microformat dates are the 
	<a href="http://www.w3.org/TR/NOTE-datetime">W3C Note datetime</a> profile and 
	<a href="http://www.ietf.org/rfc/rfc3339.txt">RFC 3339</a> profile.   
    </p>
    
   
   
   <h2>Convert to W3C Note datetime profile</h2>
   <p>This code takes either of the two profiles and returns a date time formatted to the W3C Note DateTime Profile.</p>
	    
 
	<form>
		<input id="date1" name="date1" type="text" style="width: 256px" value="20080501t13:45:00.0145" />
		<input name="normalise" type="button" value="normalise" onclick="checkDates('date1')" />
	</form>
	
	
	<h2>Compare</h2>
   	<p>This code takes the two dates in either profile and compares them to see if they are equal.  </p>

	<form>
		<input id="date2" name="date2" type="text" style="width: 256px" value="2008-05-30T13:00:00" />
		<input id="date3" name="date3" type="text" style="width: 256px" value="20080530t13" />
		<input name="compare" type="button" value="compare" onclick="compareDates('date2','date3')" />
	</form>

	

	<p>&nbsp;</p>
	
	
	<h2>W3C Note datetime</h2>
   	<p>W3C Note datetime - summary of rules which create the subset profile</p>
	<ul>
		<li>MUST use extended ISO 8601 format with punctuation for better human readability</li> 
		<li>MUST use T punctuation to mark the beginning of the time segment</li>
		<li>MUST NOT use single space punctuation for beginning of the time segment</li>
		<li>MUST NOT use decimal fraction on hours or minutes</li>
		<li>MAY use decimal fraction for seconds</li>
		<li>Punctuation MUST be uppercased</li>
		<li>MUST use a full 4 digit year</li>
	</ul>
	
	<h2>W3C Note datetime format examples</h2>

<pre>
W3C Note datetime profile - valid structures 
2007
2007-05
2007-05-01T11:30
2007-05-01T11:30Z
2007-05-01T11:30:00Z
2007-05-01T11:30+08:00
2007-05-01T11:30:00+08:00
2007-05-01T11:30:00.0135
</pre>


	
	<h2>RFC 3339</h2>
   	<p>RFC 3339 - summary of rules which create the subset profile</p>
	<ul>
		<li>MAY use standard or extended ISO 8601 format punctuation </li> 
		<li>MUST use T punctuation to mark the beginning of the time segment</li>
		<li>MUST NOT use single space punctuation for beginning of the time segment</li>
		<li>MUST NOT use decimal fraction on hours or minutes</li>
		<li>MAY use decimal fraction for seconds</li>
		<li>Punctuation MAY be in uppercase or lowercase</li>
		<li>MUST use a full 4 digit year</li>
	</ul>
	
	
	<h2>RFC 3339 format examples</h2>
	
	<pre>
RFC 3339 profile - valid structures 	
2007
2007-05
2007-05-01T11:30
2007-05-01T11:30Z
2007-05-01T11:30:00Z
2007-05-01T11:30+08:00
2007-05-01T11:30:00+08:00
2007-05-01T11:30:00.0135
200801
20080121
20070501T1130
20070501T113015
20070501T113015Z
20070501t113025z
2007-05-01T113025
20070501T11:30:25
</pre>


<h2>Vaild ISO 8601 datatime that SHOULD NOT be used in Microformats</h2>
<p>Although the following formats may be valid ISO structures they are not part 
of the two profiles use for microformats and should not be used.&nbsp; </p>
<pre>
070501	
07-05-01
20070501 1130
20070501 113015Z
2007-05-01 11:30:00+08:00
2007-05-01 11:30:00.0135
2007-05-01T11.0150
2007-05-01T11:30.0150
2008-W21
2008W21
2008-W21-5
2008W215
2008-144
2008144
etc...
</pre>

	
	<p>&nbsp;</p>

	<a rel="license" href="license.txt">Some rights reserved</a>
    
    
</body>
</html>
